package com.itheima.mp.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.mp.domain.po.User;

import com.itheima.mp.mapper.UserMapperMP;
import com.itheima.mp.service.IUserService;

import java.util.List;

public class UserServiceImpl extends ServiceImpl<UserMapperMP, User> implements IUserService {
    public List<User> queryUser(String name, Integer status, Integer minBalance, Integer maxBalance) {
        return lambdaQuery()
                .like(name != null, user -> user.getUsername(), name)
                .eq(status != null, User::getStatus, status)
                .between(minBalance != null && maxBalance != null, User::getBalance, minBalance, maxBalance)
                .list();
    }
}

